import 'package:winkai/generated/json/base/json_convert_content.dart';
import 'package:winkai/entity/vip_product_info.dart';
import 'package:winkai/ext/ext.dart';

import 'package:in_app_purchase/in_app_purchase.dart';

import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart';

import 'package:in_app_purchase_storekit/store_kit_wrappers.dart';


VipProductInfo $VipProductInfoFromJson(Map<String, dynamic> json) {
  final VipProductInfo vipProductInfo = VipProductInfo();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    vipProductInfo.name = name;
  }
  final String? productId = jsonConvert.convert<String>(json['productId']);
  if (productId != null) {
    vipProductInfo.productId = productId;
  }
  final String? price = jsonConvert.convert<String>(json['price']);
  if (price != null) {
    vipProductInfo.price = price;
  }
  final double? rawPrice = jsonConvert.convert<double>(json['rawPrice']);
  if (rawPrice != null) {
    vipProductInfo.rawPrice = rawPrice;
  }
  final String? currencyCode = jsonConvert.convert<String>(
      json['currencyCode']);
  if (currencyCode != null) {
    vipProductInfo.currencyCode = currencyCode;
  }
  final String? currencySymbol = jsonConvert.convert<String>(
      json['currencySymbol']);
  if (currencySymbol != null) {
    vipProductInfo.currencySymbol = currencySymbol;
  }
  final String? saveRate = jsonConvert.convert<String>(json['saveRate']);
  if (saveRate != null) {
    vipProductInfo.saveRate = saveRate;
  }
  final String? hourPrice = jsonConvert.convert<String>(json['hourPrice']);
  if (hourPrice != null) {
    vipProductInfo.hourPrice = hourPrice;
  }
  final bool? isYear = jsonConvert.convert<bool>(json['isYear']);
  if (isYear != null) {
    vipProductInfo.isYear = isYear;
  }
  return vipProductInfo;
}

Map<String, dynamic> $VipProductInfoToJson(VipProductInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['productId'] = entity.productId;
  data['price'] = entity.price;
  data['rawPrice'] = entity.rawPrice;
  data['currencyCode'] = entity.currencyCode;
  data['currencySymbol'] = entity.currencySymbol;
  data['saveRate'] = entity.saveRate;
  data['hourPrice'] = entity.hourPrice;
  data['isYear'] = entity.isYear;
  return data;
}

extension VipProductInfoExtension on VipProductInfo {
  VipProductInfo copyWith({
    String? name,
    String? productId,
    String? price,
    double? rawPrice,
    String? currencyCode,
    String? currencySymbol,
    String? saveRate,
    String? hourPrice,
    bool? isYear,
  }) {
    return VipProductInfo()
      ..name = name ?? this.name
      ..productId = productId ?? this.productId
      ..price = price ?? this.price
      ..rawPrice = rawPrice ?? this.rawPrice
      ..currencyCode = currencyCode ?? this.currencyCode
      ..currencySymbol = currencySymbol ?? this.currencySymbol
      ..saveRate = saveRate ?? this.saveRate
      ..hourPrice = hourPrice ?? this.hourPrice
      ..isYear = isYear ?? this.isYear;
  }
}